--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit dfc469582de97bddf97628199185a63b73090716
Parents : c7e5149
Author : Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-04-17T23:38:31-05:00
fix(workflows): update Android NDK installation process in build workflow to check for preinstalled sdkmanager and streamline license acceptance
Changes
Diff
diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml
index 01c98cc4..cd408a6d 100644
--- a/.github/workflows/android-build.yml
+++ b/.github/workflows/android-build.yml
@@ -93,19 +93,22 @@ jobs:
./rustup-init.sh -y --profile minimal --default-toolchain stable
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- - name: Set up Android SDK for Chaquopy native wheels
+ - name: Install Android NDK for Chaquopy native wheels
run: |
set -euo pipefail
- SDK_ROOT="${RUNNER_TEMP}/android-sdk"
- mkdir -p "${SDK_ROOT}/cmdline-tools"
- curl -fsSL -o /tmp/android-cmdline-tools.zip \
- "https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip"
- unzip -q /tmp/android-cmdline-tools.zip -d /tmp
- rm -f /tmp/android-cmdline-tools.zip
- mv /tmp/cmdline-tools "${SDK_ROOT}/cmdline-tools/latest"
- yes | "${SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" --sdk_root="${SDK_ROOT}" --licenses >/dev/null
- yes | "${SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" --sdk_root="${SDK_ROOT}" \
- "ndk;27.3.13750724" "platform-tools" >/dev/null
+ SDK_ROOT="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-/usr/local/lib/android/sdk}}"
+ SDKMANAGER="${SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager"
+ if [[ ! -x "${SDKMANAGER}" ]]; then
+ echo "Expected preinstalled sdkmanager at ${SDKMANAGER}" >&2
+ exit 1
+ fi
+ NDK_VERSION="27.3.13750724"
+ # Feed a bounded stream of 'y' so the producer cannot SIGPIPE under set -o pipefail.
+ yes_n() { for _ in $(seq 1 "$1"); do echo y; done; }
+ if [[ ! -d "${SDK_ROOT}/ndk/${NDK_VERSION}" ]]; then
+ yes_n 200 | "${SDKMANAGER}" --sdk_root="${SDK_ROOT}" --licenses >/dev/null
+ yes_n 50 | "${SDKMANAGER}" --sdk_root="${SDK_ROOT}" "ndk;${NDK_VERSION}" >/dev/null
+ fi
{
echo "ANDROID_HOME=${SDK_ROOT}"
echo "ANDROID_SDK_ROOT=${SDK_ROOT}"
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────